#!/bin/bash
#####################################
APP_NAME=jacktrip
APP_NAME_QUOTES=\"${APP_NAME}\"
######################################
## Created by Juan-Pablo Caceres
## qmake file to generate universal binary.
## This was tested with MacOS X 10.5, in an Intel Machine, but should work
## from 10.3.9 on, with proper configuration
## Notes: this qmake files compiles using Static Qt Librairies.
##        to install qt using static librairies on osx, configure as:
##        ./configure -nomake examples -static -release -no-framework -universal
## You also need 'Jack OS X' Installed, for the jack library
## http://www.jackosx.com/

#Cleanup
rm $APP_NAME.pro
rm Makefile
echo "cleanup done"

#Create project (.pro) file
qmake -project -o $APP_NAME.pro
echo "qmake .pro built."

#Create Makefile
qmake -makefile -o Makefile \
"CONFIG += qt release thread" \
"CONFIG -= app_bundle" \
"QT -= gui" \
"QT += network" \
"INCLUDEPATH+=/usr/local/include" \
"LIBS += -ljack -lm -framework CoreAudio" \
"QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk" \
"CONFIG += x86 ppc" \
"TARGET = $APP_NAME" \
"DEFINES += APP_NAME=${APP_NAME_QUOTES} __MAC_OSX__" \
"DESTDIR = ./" \
"QMAKE_CLEAN += ./$APP_NAME" \
"target.path = /usr/bin" \
"INSTALLS += target" \
$APP_NAME.pro

echo "done"

## Notes:
## To link jack as framework
## "LIBS += -framework jack
## "QMAKE_LFLAGS += -L/System/Library/Frameworks/Kernel.framework" \
## "QMAKE_LFLAGS += -L/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Headers/kern" \
## "QMAKE_LFLAGS += -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers/" \
## "QMAKE_LFLAGS += -L/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/" 
## "LIBS += -ljack -lm -framework CoreAudio -lcrypto" \
